<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */

/**
 * This class is able to render plain text views.
 */
class FW_View_Plain extends FW_View_Abstract
{
	/**
	 * @var string The source to output to the screen.
	 */
	private $source;

	/**
	 * @var string The content type to output the source in.
	 */
	private $contentType;

    /**
     * Initializes a new instance of this class.
     * @param string $source The source to render.
	 * @param string $ContentType The content type to output in.
	 */
	public function __construct($source, $contentType = 'text/plain')
    {
		$this->source = $source;
		$this->contentType = $contentType;
    }

    /**
     * Renders the view to the screen.
     * @param FW_Controller_Action $controller The controller that wants the rendering to be done.
     * @param string $actionName The name of the action that wants the rendering to be done.
     */
    public function render(FW_Controller_Action $controller, $actionName)
    {
		header('Content-Type: ' . $this->contentType);

		echo $this->source;
    }
}
